package com.lingyun.ucm.web.mvc.controller;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 
 * @author Terrence2013
 * 2018年1月24日 上午9:52:02
 * 登录Servlet
 */
public class LoginServlet extends HttpServlet {
    /**
     *
     */
    private static final long serialVersionUID = 1098643732249824464L;

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) {
        try {
            req.setCharacterEncoding("UTF-8");
            resp.setContentType("text/html;charset=utf-8");
            String username = req.getParameter("username");
            String password = req.getParameter("password");
            if ("cuihua".equals(username) && "111".equals(password)) {
                req.getRequestDispatcher("/WEB-INF/pages/dashboard.jsp").forward(req, resp);
            } else {
                req.getRequestDispatcher("/login.jsp").forward(req, resp);
            }
        } catch (Exception e) {
            //异常不处理
        }
    }
}
